﻿using JinShun.OA.UI.Apis;
using JinShun.OA.UI.Auth;
using JinShun.OA.UI.Dtos.Navigation;
using JinShun.OA.UI.IServer.Navigation;
using JinShun.OA.UI.Urls;

namespace JinShun.OA.UI.Services.Navigation
{
    public class NavigationService : INavigation
    {
        private readonly TokenHelper tokenHelper;
        private readonly HttpWebClient http;
        public NavigationService(TokenHelper tokenHelper, HttpWebClient http)
        {
            this.tokenHelper = tokenHelper;
            this.http = http;
        }
        public async Task<List<NavigationOutDto>> GetAllMenusAsync()
        {
            var token = await tokenHelper.GetTokenAsync();
            List<NavigationOutDto> um = await http.ExecuteAsync<List<NavigationOutDto>>(UrlBases.GetRouterByroot_Reques, HttpMethod.Get, null, token);
            return um;
        }
    }
}
